﻿using System;
using System.Windows.Automation;

namespace QuickUIT.Controls
{
    /// <summary>
    /// Represents a header item control. 
    /// </summary>
    public class UIHeaderItem : UIBaseControl
    {
        /// <summary>
        /// Gets a value which indicates whether the control can be resized. 
        /// </summary>
        public new bool CanResize
        {
            get { return base.CanResize; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class. 
        /// </summary>
        public UIHeaderItem()
            : base(ControlType.HeaderItem)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class.
        /// </summary>
        /// <param name="parent">The parent of this control.</param>
        public UIHeaderItem(UIBaseControl parent)
            : base(parent, ControlType.HeaderItem)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class.
        /// </summary>
        /// <param name="locator">The locator used to find the specific control.</param>
        public UIHeaderItem(string locator)
            : base(null, ControlType.HeaderItem, locator)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class.
        /// </summary>
        /// <param name="parent">The parent of this control.</param>
        /// <param name="locator">The locator used to find the specific control.</param>
        public UIHeaderItem(UIBaseControl parent, string locator)
            : base(parent, ControlType.HeaderItem, locator)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class.
        /// </summary>
        /// <param name="control">The underlying <see cref="AutomationElement"/> of the control.</param>
        public UIHeaderItem(AutomationElement control) : base(control, ControlType.HeaderItem)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UIHeaderItem"/> class.
        /// </summary>
        /// <param name="parent">The parent of the control</param>
        /// <param name="control">The underlying <see cref="AutomationElement"/> of the control.</param>
        public UIHeaderItem(UIBaseControl parent, AutomationElement control) : base(parent, control, ControlType.HeaderItem)
        {
        }

        /// <summary>
        /// Invokes the header item control to sort the data. 
        /// </summary>
        /// <exception cref="InvalidOperationException">The control pattern cannot be performed by the element.</exception>
        /// <exception cref="ElementNotAvailableException">The element is not available anymore.</exception>
        public new void Invoke()
        {
            base.Invoke();
        }

        /// <summary>
        /// Resizes the header control. 
        /// </summary>
        /// <param name="width">The new width of the window, in pixels.</param>
        /// <param name="height">The new height of the window, in pixels.</param>
        /// <exception cref="InvalidOperationException">The control pattern cannot be performed by the element.</exception>
        /// <exception cref="ElementNotAvailableException">The element is not available anymore.</exception>
        public new void Resize(double width, double height)
        {
            base.Resize(width, height);
        }
    }
}
